<template>
  <el-transfer v-model="transVal" :filterable="isfilter" :filter-placeholder="placeholder"
    :filter-method="filterMethod" :data="data" :titles="titles" />
</template>

<script lang="ts" setup>
import { ref } from "vue";

interface Option {
  key: number;
  label: string;
  initial: string;
}

/**
 * @param data  transfer数据源
 */
const props = defineProps({
  data: {
    type: Array,
    default: [],
  },
  placeholder: {
    type: String,
    default: "请输入筛选内容",
  },
  titles: {
    type: Array,
    default: ["选项合集", "选项合集"],
  },
  isfilter: {
    type: Boolean,
    default: false,
  },
});

const transVal = ref([]);

const filterMethod = (query, item) => {
  return item.label.toLowerCase().includes(query.toLowerCase());
};

defineExpose({ transVal });
</script>
